﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApp1
{
	internal class Book : INotifyPropertyChanged
	{
		private int m_nId;
		private string m_strName;
		private string m_strAuthor;
		private string m_strPress;

		public int Id
		{
			get => m_nId;
			set
			{
				if (m_nId != value)
				{
					m_nId = value;
					OnPropertyChanged(nameof(Id));
				}
			}
		}

		public string Name
		{
			get => m_strName;
			set
			{
				if (m_strName != value)
				{
					m_strName = value;
					OnPropertyChanged(nameof(Name));
				}
			}
		}

		public string Author
		{
			get => m_strAuthor;
			set
			{
				if (m_strAuthor != value)
				{
					m_strAuthor = value;
					OnPropertyChanged(nameof(Author));
				}
			}
		}

		public string Press
		{
			get => m_strPress;
			set
			{
				if (m_strPress != value)
				{
					m_strPress = value;
					OnPropertyChanged(nameof(Press));
				}
			}
		}

		public event PropertyChangedEventHandler PropertyChanged;

		protected virtual void OnPropertyChanged(string propertyName)
		{
			PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
		}
	}
}
